<?php


namespace App\Models\MainDB\HongBao;


use App\Models\MainDB\UserData;
use App\Models\MainDB\UserRoom;
use Illuminate\Database\Eloquent\Model;
//抢红包纪录
class GameHongHaoRecord extends Model
{
    protected $table = 'ln_game_hongbao_record';     //数据库内完整表名

    protected $primaryKey = 'id';    //主键名

    public $timestamps = false;

    public function userData()
    {
        return $this->hasOne(UserData::class, 'user_id', 'user_id');
    }
    public function userRoom()
    {
        return $this->hasOne(UserRoom::class, 'id', 'room_id');
    }
    public function getCreateTimeAttribute($key)
    {
        return $key == 0 ? '-' : date('Y-m-d H:i:s', $key);
    }
}